﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace DDFileSyncPlugin
{
    using System.Runtime.Serialization;

    /// <summary>
    /// Contains information about a client session.
    /// </summary>   
    [DataContract(Namespace = "urn:dynamicdeploy.com:2012:1:schemas")]
    public class FileInformation
    {
        /// <summary>Gets or sets the ID of the originator.</summary>
        [DataMember]
        public string OriginatorRoleInstanceId { get; set; }

        /// <summary>Gets or sets the absolute file path.</summary>
        [DataMember]
        public string AbsoluteFolderPath { get; set; }

   
        /// <summary>Gets or sets the UTC timestamp of the changed file.</summary>
        [DataMember]
        public DateTime LastModifiedTimestampUtc { get; set; }

        /// <summary>true indicates that the file can be replaced directly without triggering a storage account sync. File contents are needed in this case.</summary>
        [DataMember]
        public bool DirectReplace { get; set; }

        /// <summary>
        /// Contents of the file. Sent only if sync is not required
        /// </summary>
        [DataMember]
        public byte[] FileContents { get; set; }

        /// <summary>
        /// Name of the file to be replaced
        /// </summary>
        [DataMember]
        public string FileName { get; set; }

        /// <summary>
        /// Absolute path to the file
        /// </summary>
        [DataMember]
        public string AbsoluteFilePath { get; set; }
    }

    // custom attributes 
    public class FileChangeEventArgs : System.EventArgs
    {

        private FileInformation _fileInfo;

        public FileInformation FileInfo
        {
            get { return _fileInfo; }
            set { _fileInfo = value; }
        }

        private FileChangeType _fileChangeType;

        public FileChangeType FileChangeType
        {
            get { return _fileChangeType; }
            set { _fileChangeType = value; }
        }

        public FileChangeEventArgs()
        {


        }

        public FileChangeEventArgs(FileInformation m, FileChangeType changeType)
        {
            FileInfo = m;
            FileChangeType = changeType;
        }


    }


}
